package com.hhrpc.hhrpc.demo;

import com.hhrpc.hhrpc.core.annotation.HhRpcConsumer;
import com.hhrpc.hhrpc.core.conf.ConsumerConf;
import com.hhrpc.hhrpc.demo.api.User;
import com.hhrpc.hhrpc.demo.api.UserService;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

@SpringBootApplication
@Import(ConsumerConf.class)
public class HhrpcDemoConsumerApplication {

    @HhRpcConsumer
    private UserService userService;

    public static void main(String[] args) {
        SpringApplication.run(HhrpcDemoConsumerApplication.class, args);
    }

    @Bean
    public ApplicationRunner runServiceMethods(){
        return (x)->{
            User user = this.userService.findById(1120);
            System.out.println(user.toString());
            User user1 = this.userService.findById(1123,"liming");
            System.out.println(user1.toString());
            System.out.println(this.userService.getLongId(33));
        };
    }


}
